package com.ssm.crud.controller;

/*
*处理和部门有关的请求
* @Author szj
* */

import com.ssm.crud.bean.Department;
import com.ssm.crud.bean.Msg;
import com.ssm.crud.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class DepartmenController {

    @Autowired
    private DepartmentService departmentService;

    /**
     * 返回所有部门信息
     */
    @ResponseBody
    @RequestMapping("/Depts")
    public Msg getDepots(){

        List<Department> list = departmentService.getDepots();
        //查出所有的部门信息
        return Msg.Success().add("depts",list);
    }

}
